const config = [{
  children: [
    {
      router: "basicForm",
      role: "s"
      // children: [{
      //   children: [{ router: "dashboard", role: "dashboard" }],
      //   router: "form",
      // }]
    },
    { router: "stepForm", role: "s" },
    { router: "advanceForm", role: "basicForm" },
    { router: "analysis", role: "s" },
  ],
  router: "form_1",
  role: "dashboard"
}]
const array = ["analysis", "basicForm", "dashboard"];

function getItem(route, array) {
  route.map((element, index, arr) => {
    if (element.children && element.children.length > 0) {
      getItem(element.children)
    }else{
      console.log(element);
    }
    // console.log(element);
  });
}

getItem(config, array)